cmake_minimum_required(VERSION 3.16)
project(compilerDomeA1)

set(CMAKE_CXX_STANDARD 20)

if(WIN32)
    include_directories(D:/c_lib/include/)
    link_directories(D:/c_lib/lib/x86/Debug)
    link_libraries(ws2_32)
    link_libraries(gtestd)
endif()

if(UNIX)
    link_libraries(pthread)
    link_libraries(dl)
    link_libraries(gtest)
#    link_libraries(googletest)
endif()

set(LIB
        lib/Tools.h lib/Tools.cpp
        lib/Base/AlgorihmTemplate.h lib/Base/Server.h lib/Base/AOP_IOC.h

        #Container
        lib/Container/ThreadContainer.h
        lib/Container/Container.cpp lib/Container/Container.h

        #Platform
        lib/Platform/NetBase.cpp lib/Platform/NetBase.h
        lib/Platform/Multplex.cpp lib/Platform/Multplex.h
        lib/Platform/Library.cpp lib/Platform/Library.h

        #EventSystem
        lib/Base/EventSystem/SignalEventDrivers.h
        lib/Base/EventSystem/EventSystem.cpp lib/Base/EventSystem/EventSystem.h
        lib/Base/EventSystem/Events.h
        lib/Base/Object.cpp lib/Base/Object.h

        #Common
        lib/Common/AtomicLock.h lib/Common/AtomicLock.cpp
        lib/Common/CThread.cpp lib/Common/CThread.h
        lib/Common/Pools.cpp lib/Common/Pools.h
        )

set(System lib/System/LogSystem.cpp lib/System/LogSystem.h)
set(LIB_T ${LIB} lib/test/SignalDriverTest.cpp lib/test/ContainerTest.cpp lib/test/Common.cpp
        CRUDPA/test/BaseTest.cpp lib/test/EventTest.cpp lib/test/Base.cpp)

set(CSERVER CServer/EventLoopManager.cpp CServer/EventLoopManager.h
        CServer/ServerManager.cpp CServer/ServerManager.h
        CServer/Tools.cpp CServer/Tools.h)

set(COMPILER LexicalAnalysis.cpp LexicalAnalysis.h LanguagesDescription.h)

set(CRUDPA
        CRUDPA/Tools.h

        CRUDPA/CommonNetBase/Bbr/bbr.cpp CRUDPA/CommonNetBase/Bbr/bbr.h

        CRUDPA/CommonNetBase/Buffer.cpp CRUDPA/CommonNetBase/Buffer.h
        CRUDPA/CommonNetBase/Window.h

        CRUDPA/CommonNetBase/Controller.cpp CRUDPA/CommonNetBase/Controller.h
        CRUDPA/CommonNetBase/CongestionControl.h

        CRUDPA/Peer.cpp CRUDPA/Peer.h
        CRUDPA/CRUDP.cpp CRUDPA/CRUDP.h
        CRUDPA/Option.h CRUDPA/Agreement.h

        CRUDPA/UdpPool.cpp CRUDPA/UdpPool.h
        )

#set(ALL_SRC ${LIB} ${CRUDP} ${CSERVER})
set(ALL_SRC ${LIB} ${CRUDPA})
#set(ALL_SRC ${LIB})

add_executable(server main.cpp ${ALL_SRC})
add_executable(client main_client.cpp ${ALL_SRC})
